using System;
using UnityEngine;
using UnityEngine.EventSystems;

namespace MaterialUI
{
	[AddComponentMenu("MaterialUI/Dialogs/Clickable Option", 100)]
	public class DialogClickableOption : MonoBehaviour, IPointerClickHandler, ISubmitHandler, IEventSystemHandler
	{
		private Action<int> m_OnClickAction;

		private int m_Index;

		public Action<int> onClickAction
		{
			get
			{
				return m_OnClickAction;
			}
			set
			{
				m_OnClickAction = value;
			}
		}

		public int index
		{
			get
			{
				return m_Index;
			}
			set
			{
				m_Index = value;
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			if (m_OnClickAction != null)
			{
				m_OnClickAction(m_Index);
			}
		}

		public void OnSubmit(BaseEventData eventData)
		{
			if (m_OnClickAction != null)
			{
				m_OnClickAction(m_Index);
			}
		}
	}
}
